﻿
namespace ApplicationGenerator.DataAccess
{
    public class WorkflowDataBaseCommands : IDataBaseCommands
    {

        #region SQL Commands

        
        private const string InsertToAgFlowsTable = "INSERT INTO AG_FLOWS  VALUES(@id,@name,@binData)";
        private const string SelectFormFromAgFormsTable = "SELECT AG_BINARY_DATA FROM AG_FLOWS WHERE AG_ID = @id;";
        private const string SelectFormFromAgFlowsTableByName = "SELECT AG_BINARY_DATA FROM AG_FLOWS " +
                                                                "WHERE AG_NAME = @name;";
        private const string UpdateFlowFromAgFlowsTable = "UPDATE AG_FLOWS SET AG_BINARY_DATA = @bin_data WHERE AG_NAME = @name;";
        private const string SelectFlowNames = "SELECT AG_NAME FROM AG_FLOWS;";
        private const string SelectFlowName = "SELECT AG_NAME FROM AG_FLOWS WHERE AG_ID = @id;";
        private const string SelectVersionInfoFromAgFlowsTable = "SELECT AG_ID,AG_NAME FROM AG_FLOWS";

        #endregion

        #region Methods

        public string  CreateTableCommand()
        {
 	        throw new System.NotImplementedException();
        }

        public string  InsertToTableCommand()
        {
            return InsertToAgFlowsTable;
        }

        public string  UpdateToTableCommand()
        {
            return UpdateFlowFromAgFlowsTable;
        }

        public string  SelectFromTableCommand()
        {
            return SelectFormFromAgFormsTable;
        }

        public string SelectFromTableByNameCommand()
        {
            return SelectFormFromAgFlowsTableByName;
        }

        public string SelectNames()
        {
            throw new System.NotImplementedException();
        }

        public string SelectVersionInfo()
        {
            return SelectVersionInfoFromAgFlowsTable;
        }

        public string SelectName()
        {
            return SelectFlowName;
        }

        #endregion
    }
}
